// for...in VS for...of

let arr = [1, 2, 3, 4, 5];
let str = "hello";
let obj = {
  name: "张三",
  age: 18,
};

for (let i in arr) {
  console.log(i);
} // 0 1 2 3 4

for (let i of arr) {
  console.log(i); 
} // 1 2 3 4 5

for (let i in str) {
  console.log(i); 
}// 0 1 2 3 4

for (let i of str) {
  console.log(i);
}// h e l l o

for (let i in obj) {
  console.log(i); 
} // name age

for (let i of obj) {
  console.log(i);
} // obj is not iterable